package com.chatplus.application.domain.dto;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;

import java.io.Serializable;

@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class ChatConfigDto implements Serializable {

    /**
     * azure : {"api_url":"https://chat-bot-api.openai.azure.com/openai/deployments/{ws}/chat/completions?api-version=2023-05-15","max_tokens":1024,"temperature":1}
     * baidu : {"api_url":"https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/{ws}","max_tokens":1024,"temperature":0.95}
     * chat_gml : {"api_url":"https://open.bigmodel.cn/api/paas/v3/model-api/{ws}/sse-invoke","max_tokens":1024,"temperature":0.95}
     * context_deep : 4
     * dall_api_url : https://api.openai.com/v1/images/generations
     * dall_img_num : 1
     * enable_context : true
     * enable_history : true
     * open_ai : {"api_url":"https://api.chatanywhere.org/v1/chat/completions","max_tokens":1024,"temperature":1}
     * xun_fei : {"api_url":"wss://spark-api.xf-yun.com/{version}/chat","max_tokens":1024,"temperature":0.5}
     */

    @JsonProperty("azure")
    private AzureSetting azure;
    @JsonProperty("baidu")
    private BaiduSetting baidu;
    @JsonProperty("chat_gml")
    private ChatGmlSetting chatGml;
    @JsonProperty("context_deep")
    private Long contextDeep;
    @JsonProperty("dall_api_url")
    private String dallApiUrl;
    @JsonProperty("dall_img_num")
    private Long dallImgNum;
    @JsonProperty("enable_context")
    private boolean enableContext;
    @JsonProperty("enable_history")
    private boolean enableHistory;
    @JsonProperty("open_ai")
    private OpenAiSetting openAi;
    @JsonProperty("xun_fei")
    private XunFeiSetting xunFei;

    @JsonIgnoreProperties(ignoreUnknown = true)
    public static class AzureSetting extends CommonSetting{
    }
    @JsonIgnoreProperties(ignoreUnknown = true)
    public static class BaiduSetting extends CommonSetting{
    }

    @JsonIgnoreProperties(ignoreUnknown = true)
    public static class ChatGmlSetting  extends CommonSetting{
    }

    @JsonIgnoreProperties(ignoreUnknown = true)
    public static class OpenAiSetting extends CommonSetting{
    }

    @JsonIgnoreProperties(ignoreUnknown = true)
    public static class XunFeiSetting  extends CommonSetting{
    }
    @Data
    @JsonIgnoreProperties(ignoreUnknown = true)
    public static class CommonSetting implements Serializable{
        @JsonProperty("max_tokens")
        private Integer maxTokens;
        @JsonProperty("temperature")
        private float temperature;

    }
}
